package com.mmc.controller;

import com.mmc.client.ContentClient;
import com.mmc.entity.Content;
import com.mmc.service.PortalService;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 作者：李嘉浩
 * 时间：2024-09-16-16:45
 * 功能：
 */

@Controller
@RequestMapping
public class PortalController {
    @Autowired
    private PortalService portalService;


    //1. 门户首页
    @GetMapping({"/","/index.html"})
    public String index(Model model){

        List<Content> contentList=portalService.findByCategoryId(1L);
        // List<Content> contentList=portalService.findByCategoryId1(1L);
        model.addAttribute("contentList",contentList);
        return "index";  // 转换为物理视图----》  classpath: /templates/index.html
    }
}
